package ebj.common.multithread;


public class MyThread2 implements Runnable {
    private int __COUNTER = 50;
    private boolean isrunning = true;
    
    public void run() {
        while (isrunning) {
            action();
        }
    }
    
    private synchronized void action() {
        if (__COUNTER > 0) {
            System.out.println(Thread.currentThread().getName() + "" + String.valueOf(__COUNTER --));
        }else {
            this.isrunning = false;
        }
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
